<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">

        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">应用名称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="appName" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">配置名称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="configName" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">执行日期</label>
                            <div class="layui-input-inline">
                                <input type="text" name="timerTimeStr" id="timerTimeStrId" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
        <script type="text/html" id="currentTableBar">
            <a class="layui-btn layui-btn-xs layui-btn-warm data-count-delete" lay-event="reStart">重提</a>
        </script>
    </div>
</div>

<script>
    layui.use(['form', 'table','miniPage','element','laydate'], function () {
        var $ = layui.jquery, form = layui.form, table = layui.table, miniPage = layui.miniPage,laydate = layui.laydate;;
        laydate.render({ 
            elem: '#timerTimeStrId',
            type: 'date'
        });
        table.render({
            elem: '#currentTableId',
            url: 'app/timer/logs/list',
            request: {
                pageName: 'pageNum' //页码的参数名称，默认：page
                ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
             },
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            parseData: function(res){ //res 即为原始返回的数据
                return {
                  "code": res.errorCode, //解析接口状态
                  "msg": res.errorMsg, //解析提示文本
                  "count": res.data.total, //解析数据长度
                  "data": res.data.list //解析数据列表
                };
              },
            cols: [[
                {type: "checkbox", width: 50},
                {field: 'id',  title: 'ID',hide:true},
                {field: 'appName',  title: '应用名称'},
                {field: 'configName',  title: '配置名称'},
                {field: 'timerTimeStr', title: '执行时间'},
                {field: 'timerStatus', title: '执行状态',templet: function(d){
                	if(d.timerStatus==1){
                		return '成功'
                	}else if(d.timerStatus==2){
                		return '失败'
                	}else {
                		return '未知'
                	}
                  }},
                {field: 'timerMsg', title: '异常信息'},
                {title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
            ]],
            limits: [10, 20, 30, 50, 100],
            limit: 10,
            page: true,
            skin: 'line'
        });
        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: data.field
            }, 'data');
            return false;
        });
        table.on('tool(currentTableFilter)', function (obj) {
            var data = obj.data;
            if (obj.event === 'reStart') {
            	layer.msg("功能建设中...", {icon: 4});
            }
        });
    });
</script>